home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / streaming / qtspacketizerreassembler / componentvideortp / headers / componentvideopayload.h next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  5.8 KB  |  221 lines

  1. /*
  2.     File:        ComponentVideoPayload.h
  3.  
  4.     Contains:    Declaration of ComponentVideoPayload datatype and its operations
  5.  
  6.     Copyright:    © 1997-1999 by Apple Computer Inc. all rights reserved.
  7.  
  8.     
  9.     
  10.     X-Sample-YUV-422-v0 Payload Format
  11.     -----------------------------------------------------------------
  12.     
  13.                          1                   2                   3
  14.      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  15.     +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
  16.     |D|                      Description Seed                       |
  17.     +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
  18.     |                        Offset                         |  MBZ  |
  19.     +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
  20.     :                      Payload Description                      :
  21.     +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
  22.     :                          Image Data                           :
  23.     +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
  24.     
  25.     
  26.     D - 1 bit
  27.     
  28.         Set if, and only if, Payload Description is present.
  29.     
  30.     
  31.     Description Seed - 31 bits
  32.     
  33.         A payload description seed that increments cyclically
  34.         whenever the payload description changes.
  35.         
  36.         
  37.     Offset - 28 bits
  38.     
  39.         Positive offset from the start of the current frame to the
  40.         start of image data contained in this payload as counted in
  41.         32-bit words. Multiply by 4 to compute the offset in octets.
  42.     
  43.     
  44.     MBZ - 4 bits
  45.     
  46.         Reserved.  Must be zero.
  47.     
  48.     
  49.     Payload Description - described below
  50.         
  51.         Present if, and only if, the D bit is set.
  52.     
  53.     
  54.     Image Data - 0 or more 32-bit words
  55.         
  56.         YUV 4:2:2 encoded image data.  Might be omitted if Payload
  57.         Description is present.
  58.     
  59.     
  60.     
  61.     Payload Description Format
  62.     -----------------------------------------------------------------
  63.     
  64.                          1                   2                   3
  65.      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  66.     +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
  67.     | Z |            Width            |            Height           |
  68.     +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
  69.     
  70.     
  71.     Z - 2 bits
  72.     
  73.         Reserved.  Must be zero.
  74.     
  75.     
  76.     Width - 15 bits
  77.     
  78.         Positive integer specifying width of current frame in pixels.
  79.     
  80.     
  81.     Height - 15 bits
  82.         
  83.         Positive integer specifying height of current frame in pixels.
  84.  
  85. */
  86.  
  87.  
  88.  
  89. #ifndef __COMPONENTVIDEOPAYLOAD__
  90. #define __COMPONENTVIDEOPAYLOAD__
  91.  
  92.  
  93.  
  94. /* ---------------------------------------------------------------------------
  95.  *        H E A D E R S
  96.  * ---------------------------------------------------------------------------
  97.  */
  98.  
  99. #include <MacTypes.h>
  100.  
  101.  
  102.  
  103. /* ---------------------------------------------------------------------------
  104.  *        C O N S T A N T S
  105.  * ---------------------------------------------------------------------------
  106.  */
  107.  
  108. enum
  109. {
  110.     kComponentVideoPayloadFixedHeaderWordCount    = 2,
  111.     kComponentVideoPayloadDescriptionWordCount    = 1
  112. };
  113.  
  114.  
  115.  
  116. /* ---------------------------------------------------------------------------
  117.  *        D A T A T Y P E S
  118.  * ---------------------------------------------------------------------------
  119.  *
  120.  *    The ComponentVideoPayload structure represents the payload format defined
  121.  *    above.  Unfortunately, the position of bit fields in C data structures is
  122.  *    implementation-dependent, so the data structure cannot declare individual
  123.  *    fields of the payload format.
  124.  *
  125.  */
  126.  
  127.  
  128.  
  129. typedef struct
  130. {
  131.     UInt32    itsFixedHeader[ kComponentVideoPayloadFixedHeaderWordCount ];
  132.     union
  133.     {
  134.         UInt32    itsDescription[ kComponentVideoPayloadDescriptionWordCount ];
  135.         UInt32    itsImageData[ 1 ];
  136.     };
  137. } ComponentVideoPayload;
  138.  
  139.  
  140.  
  141. /* ---------------------------------------------------------------------------
  142.  *        P R O T O T Y P E S
  143.  * ---------------------------------------------------------------------------
  144.  *
  145.  *    These functions get and set fields of the ComponentVideoPayload.  Some
  146.  *    functions affect multiple fields, and some functions expect or return
  147.  *    values that differ from the representation encoded in the payload:
  148.  *
  149.  *        ComponentVideoPayloadSetOffset()
  150.  *        ComponentVideoPayloadOffset()            These functions expect or
  151.  *                                                return the offset in octets,
  152.  *                                                not 32-bit words
  153.  *
  154.  *        ComponentVideoPayloadSetDescription()    This function implicitly sets
  155.  *                                                the description flag (D) field
  156.  *                                                if inWidth and inHeight are
  157.  *                                                both non-zero.  If inWidth or
  158.  *                                                inHeight is zero, this
  159.  *                                                function clears the
  160.  *                                                description flag, but does not
  161.  *                                                modify the Width or Height
  162.  *                                                fields in the given
  163.  *                                                ComponentPayloadDescription.
  164.  *        
  165.  *        ComponentVideoPayloadCopyDescription()    This function copies the
  166.  *                                                description flag (D) and
  167.  *                                                Description Seed fields as
  168.  *                                                well as the Payload
  169.  *                                                Description field.
  170.  */
  171.  
  172. UInt32
  173. ComponentVideoPayloadDescriptionSeedLimit(
  174.     void );
  175.  
  176. ComponentVideoPayload *
  177. ComponentVideoPayloadInitialize(
  178.     ComponentVideoPayload *        inPayload,
  179.     UInt16                        inWidth,
  180.     UInt16                        inHeight );
  181.  
  182. UInt32
  183. ComponentVideoPayloadSetOffset(
  184.     ComponentVideoPayload *        inPayload,
  185.     UInt32                        inOffset );
  186.  
  187. UInt32
  188. ComponentVideoPayloadSetDescription(
  189.     ComponentVideoPayload *        inPayload,
  190.     UInt16                        inWidth,
  191.     UInt16                        inHeight );
  192.  
  193. UInt32
  194. ComponentVideoPayloadCopyDescription(
  195.     ComponentVideoPayload *            inTargetPayload,
  196.     const ComponentVideoPayload *    inSourcePayload );
  197.  
  198. Boolean
  199. ComponentVideoPayloadHasDescription(
  200.     const ComponentVideoPayload *    inPayload );
  201.  
  202. UInt32
  203. ComponentVideoPayloadDescriptionSeed(
  204.     const ComponentVideoPayload *    inPayload );
  205.  
  206. UInt32
  207. ComponentVideoPayloadOffset(
  208.     const ComponentVideoPayload *    inPayload );
  209.  
  210. UInt16
  211. ComponentVideoPayloadWidth(
  212.     const ComponentVideoPayload *    inPayload );
  213.  
  214. UInt16
  215. ComponentVideoPayloadHeight(
  216.     const ComponentVideoPayload *    inPayload );
  217.  
  218.  
  219.  
  220. #endif /* __COMPONENTVIDEOPAYLOAD__ */
  221.